Remove send_IPI_all, send_IPI_allbutself and send_IPI_self
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 3 Apr 2006 15:35:06 +0000 (16:35 +0100)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Mon, 3 Apr 2006 15:35:06 +0000 (16:35 +0100)
shortcutting IPI functions. They're either unused or used so
frequently that we may as well simplify things and always use
send_IPI_mask.

Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/genapic/default.c
xen/arch/x86/smp.c
xen/include/asm-x86/genapic.h
xen/include/asm-x86/mach-bigsmp/mach_ipi.h
xen/include/asm-x86/mach-default/mach_ipi.h
xen/include/asm-x86/mach-es7000/mach_ipi.h
xen/include/asm-x86/mach-generic/mach_ipi.h
xen/include/asm-x86/mach-summit/mach_ipi.h

index 88853e02902c77f0eac0c10b3dc3a17be4c26f78..d84cf4114186fd909623e91ce483e592ae07bd54 100644 (file)
 #include <asm/mach-default/mach_ipi.h>
 #include <asm/mach-default/mach_mpparse.h>
 
-#ifdef CONFIG_HOTPLUG_CPU
-#define DEFAULT_SEND_IPI       (1)
-#else
-#define DEFAULT_SEND_IPI       (0)
-#endif
-
-int no_broadcast = DEFAULT_SEND_IPI;
-integer_param("no_ipi_broadcast", no_broadcast);
-
 /* should be called last. */
 static __init int probe_default(void)
 { 
@@ -34,12 +25,3 @@ static __init int probe_default(void)
 } 
 
 struct genapic apic_default = APIC_INIT("default", probe_default); 
-
-static int __init print_ipi_mode(void)
-{
-       if (genapic == &apic_default)
-               printk("Using IPI %sShortcut mode\n",
-                      no_broadcast ? "No-" : "");
-       return 0;
-}
-__initcall(print_ipi_mode);
index fc0a545883e71939e466a04b029f457a022fbcaa..18240da6f5b43d74376137436e4efce1a057cdc1 100644 (file)
@@ -21,6 +21,7 @@
 #include <asm/smpboot.h>
 #include <asm/hardirq.h>
 #include <mach_apic.h>
+#include <mach_ipi.h>
 
 /*
  *     Some notes on x86 processor bugs affecting SMP operation:
@@ -74,38 +75,6 @@ static inline int __prepare_ICR2 (unsigned int mask)
     return SET_APIC_DEST_FIELD(mask);
 }
 
-void __send_IPI_shortcut(unsigned int shortcut, int vector)
-{
-    /*
-     * Subtle. In the case of the 'never do double writes' workaround
-     * we have to lock out interrupts to be safe.  As we don't care
-     * of the value read we use an atomic rmw access to avoid costly
-     * cli/sti.  Otherwise we use an even cheaper single atomic write
-     * to the APIC.
-     */
-    unsigned int cfg;
-
-    /*
-     * Wait for idle.
-     */
-    apic_wait_icr_idle();
-
-    /*
-     * No need to touch the target chip field
-     */
-    cfg = __prepare_ICR(shortcut, vector);
-
-    /*
-     * Send the IPI. The write to APIC_ICR fires this off.
-     */
-    apic_write_around(APIC_ICR, cfg);
-}
-
-void send_IPI_self(int vector)
-{
-    __send_IPI_shortcut(APIC_DEST_SELF, vector);
-}
-
 static inline void check_IPI_mask(cpumask_t cpumask)
 {
     /*
@@ -116,9 +85,6 @@ static inline void check_IPI_mask(cpumask_t cpumask)
     ASSERT(!cpus_empty(cpumask));
 }
 
-/*
- * This is only used on smaller machines.
- */
 void send_IPI_mask_bitmask(cpumask_t cpumask, int vector)
 {
     unsigned long mask = cpus_addr(cpumask)[0];
@@ -168,36 +134,33 @@ inline void send_IPI_mask_sequence(cpumask_t mask, int vector)
 
     local_irq_save(flags);
 
-    for (query_cpu = 0; query_cpu < NR_CPUS; ++query_cpu) {
-        if (cpu_isset(query_cpu, mask)) {
-               
-            /*
-             * Wait for idle.
-             */
-            apic_wait_icr_idle();
+    for_each_cpu_mask( query_cpu, mask )
+    {
+        /*
+         * Wait for idle.
+         */
+        apic_wait_icr_idle();
                
-            /*
-             * prepare target chip field
-             */
-            cfg = __prepare_ICR2(cpu_to_logical_apicid(query_cpu));
-            apic_write_around(APIC_ICR2, cfg);
+        /*
+         * prepare target chip field
+         */
+        cfg = __prepare_ICR2(cpu_to_logical_apicid(query_cpu));
+        apic_write_around(APIC_ICR2, cfg);
                
-            /*
-             * program the ICR
-             */
-            cfg = __prepare_ICR(0, vector);
+        /*
+         * program the ICR
+         */
+        cfg = __prepare_ICR(0, vector);
                        
-            /*
-             * Send the IPI. The write to APIC_ICR fires this off.
-             */
-            apic_write_around(APIC_ICR, cfg);
-        }
+        /*
+         * Send the IPI. The write to APIC_ICR fires this off.
+         */
+        apic_write_around(APIC_ICR, cfg);
     }
+
     local_irq_restore(flags);
 }
 
-#include <mach_ipi.h>
-
 static spinlock_t flush_lock = SPIN_LOCK_UNLOCKED;
 static cpumask_t flush_cpumask;
 static unsigned long flush_va;
@@ -241,20 +204,12 @@ void __flush_tlb_mask(cpumask_t mask, unsigned long va)
 /* Call with no locks held and interrupts enabled (e.g., softirq context). */
 void new_tlbflush_clock_period(void)
 {
-    ASSERT(local_irq_is_enabled());
-    
+    cpumask_t allbutself;
+
     /* Flush everyone else. We definitely flushed just before entry. */
-    if ( num_online_cpus() > 1 )
-    {
-        spin_lock(&flush_lock);
-        flush_cpumask = cpu_online_map;
-        flush_va      = FLUSHVA_ALL;
-        send_IPI_allbutself(INVALIDATE_TLB_VECTOR);
-        cpu_clear(smp_processor_id(), flush_cpumask);
-        while ( !cpus_empty(flush_cpumask) )
-            cpu_relax();
-        spin_unlock(&flush_lock);
-    }
+    allbutself = cpu_online_map;
+    cpu_clear(smp_processor_id(), allbutself);
+    __flush_tlb_mask(allbutself, FLUSHVA_ALL);
 
     /* No need for atomicity: we are the only possible updater. */
     ASSERT(tlbflush_clock == 0);
index e7c1356dcb96720230681e0fa831bf229943aa13..2c7fa476f302182ca9865bc3264caf3a85340ff4 100644 (file)
@@ -54,8 +54,6 @@ struct genapic {
        
        /* ipi */
        void (*send_IPI_mask)(cpumask_t mask, int vector);
-       void (*send_IPI_allbutself)(int vector);
-       void (*send_IPI_all)(int vector);
 }; 
 
 #define APICFUNC(x) .x = x
@@ -85,8 +83,6 @@ struct genapic {
        APICFUNC(cpu_mask_to_apicid), \
        APICFUNC(acpi_madt_oem_check), \
        APICFUNC(send_IPI_mask), \
-       APICFUNC(send_IPI_allbutself), \
-       APICFUNC(send_IPI_all), \
        APICFUNC(enable_apic_mode), \
        APICFUNC(phys_pkg_id), \
        }
index 9404c535b7ecbbf6f496d0cd80f4eb266a529208..c487589d942a95dcf49ec5c220d6a6c63afa26fe 100644 (file)
@@ -8,18 +8,4 @@ static inline void send_IPI_mask(cpumask_t mask, int vector)
        send_IPI_mask_sequence(mask, vector);
 }
 
-static inline void send_IPI_allbutself(int vector)
-{
-       cpumask_t mask = cpu_online_map;
-       cpu_clear(smp_processor_id(), mask);
-
-       if (!cpus_empty(mask))
-               send_IPI_mask(mask, vector);
-}
-
-static inline void send_IPI_all(int vector)
-{
-       send_IPI_mask(cpu_online_map, vector);
-}
-
 #endif /* __ASM_MACH_IPI_H */
index a1d0072e36bc8f9fc15163544b2c374db789527a..069f16cedea4b1c1514e0b39c752c1191ae560ad 100644 (file)
@@ -2,50 +2,10 @@
 #define __ASM_MACH_IPI_H
 
 void send_IPI_mask_bitmask(cpumask_t mask, int vector);
-void __send_IPI_shortcut(unsigned int shortcut, int vector);
-
-extern int no_broadcast;
 
 static inline void send_IPI_mask(cpumask_t mask, int vector)
 {
        send_IPI_mask_bitmask(mask, vector);
 }
 
-static inline void __local_send_IPI_allbutself(int vector)
-{
-       if (no_broadcast) {
-               cpumask_t mask = cpu_online_map;
-
-               cpu_clear(smp_processor_id(), mask);
-               send_IPI_mask(mask, vector);
-       } else
-               __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
-}
-
-static inline void __local_send_IPI_all(int vector)
-{
-       if (no_broadcast)
-               send_IPI_mask(cpu_online_map, vector);
-       else
-               __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
-}
-
-static inline void send_IPI_allbutself(int vector)
-{
-       /*
-        * if there are no other CPUs in the system then we get an APIC send 
-        * error if we try to broadcast, thus avoid sending IPIs in this case.
-        */
-       if (!(num_online_cpus() > 1))
-               return;
-
-       __local_send_IPI_allbutself(vector);
-       return;
-}
-
-static inline void send_IPI_all(int vector)
-{
-       __local_send_IPI_all(vector);
-}
-
 #endif /* __ASM_MACH_IPI_H */
index 5e61bd220b06c3b8b5f0a816c02d5ecc592e7145..c487589d942a95dcf49ec5c220d6a6c63afa26fe 100644 (file)
@@ -8,17 +8,4 @@ static inline void send_IPI_mask(cpumask_t mask, int vector)
        send_IPI_mask_sequence(mask, vector);
 }
 
-static inline void send_IPI_allbutself(int vector)
-{
-       cpumask_t mask = cpu_online_map;
-       cpu_clear(smp_processor_id(), mask);
-       if (!cpus_empty(mask))
-               send_IPI_mask(mask, vector);
-}
-
-static inline void send_IPI_all(int vector)
-{
-       send_IPI_mask(cpu_online_map, vector);
-}
-
 #endif /* __ASM_MACH_IPI_H */
index 441b0fe3ed1d8142cb0ef503b5a58718f90b8137..06bfd751009295e57aaf6fcda83368d0f2cf37f5 100644 (file)
@@ -4,7 +4,5 @@
 #include <asm/genapic.h>
 
 #define send_IPI_mask (genapic->send_IPI_mask)
-#define send_IPI_allbutself (genapic->send_IPI_allbutself)
-#define send_IPI_all (genapic->send_IPI_all)
 
 #endif
index 9404c535b7ecbbf6f496d0cd80f4eb266a529208..c487589d942a95dcf49ec5c220d6a6c63afa26fe 100644 (file)
@@ -8,18 +8,4 @@ static inline void send_IPI_mask(cpumask_t mask, int vector)
        send_IPI_mask_sequence(mask, vector);
 }
 
-static inline void send_IPI_allbutself(int vector)
-{
-       cpumask_t mask = cpu_online_map;
-       cpu_clear(smp_processor_id(), mask);
-
-       if (!cpus_empty(mask))
-               send_IPI_mask(mask, vector);
-}
-
-static inline void send_IPI_all(int vector)
-{
-       send_IPI_mask(cpu_online_map, vector);
-}
-
 #endif /* __ASM_MACH_IPI_H */